import * as types from './../constants/ActionTypes';

/*
 * 消费记录列表
 ================================================================*/
export function fetchConsumeRecord({start = 1, limit = 10} = {}) {
  return  (dispatch) => {

    let payload = { 
      consume_record_status : 0, 
      message : '加载中', 
      start : start
    };

    dispatch({
      payload ,
      type: [types.FETCH_CONSUME_RECORDS, types.FETCH_CONSUME_RECORDS_SUCCESS, types.FETCH_CONSUME_RECORDS_FAILURE],
      meta: {
        fetch: [`member/score?page_no=${start}&page_size=${limit}`, {
          method: 'get'
        }]
      }  
    });
  };
}


/*
 * 消费记录列表 - 复位
 ================================================================*/
export function resetConsumeRecord(){
  return (dispatch) => {
        let payload = {
            consume_record_status: 0,
            message: '加载中',
            start : 1,
            results : []
        };
        
        dispatch({
            payload,
            type : types.RESET_CONSUME_RECORDS
        });
    };
}